package com.literature.threeGroup.controller;

import com.literature.threeGroup.pojo.*;
import com.literature.threeGroup.service.CoversService;
import com.literature.threeGroup.service.LogsService;
import com.literature.threeGroup.util.PageResult;
import com.literature.threeGroup.util.Result;
import com.literature.threeGroup.util.StatusCode;
import com.literature.threeGroup.vo.CoverVo;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @author VULCAN
 * @create 2020-01-07 14:31
 * @desc
 **/
@RestController
@CrossOrigin
public class CoversController {

    @Autowired
    private CoversService coversService;
    /**
     * @name  代理公司列表
     * @Author VULCAN
     * @Date 2020/2/1 11:50
     */
    @RequestMapping(value = "AgencyCompanyFindlist",method = RequestMethod.GET)
    public List<AgencyCompany> AgencyCompanyFindlist(){
        return coversService.AgencyCompanyFindlist();
    }
    /**
      * @name  代理公司列表 分页 模糊
     * @Author VULCAN
     * @Date 2020/2/1 12:57
     */
    @RequestMapping(value = "findAgencyCompanylikename/{pageNum}/{pageSize}",method = RequestMethod.POST)
    public Result findAgencyCompanylikename(@RequestBody AgencyCompany agencyCompany, @PathVariable("pageNum") int pageNum , @PathVariable("pageSize") int pageSize){
        PageResult findallpage = coversService.findAgencyCompanylikename(agencyCompany,pageNum, pageSize);
        return new Result(true, StatusCode.OK,"查询成功",findallpage) ;
    }
    /**
     * @name  新增代理公司
     * @Author VULCAN
     * @Date 2020/2/1 11:50
     */
    @RequestMapping(value = "AgencyCompanyadd",method = RequestMethod.POST)
    public void AgencyCompanyadd(@RequestBody AgencyCompany agencyCompany) throws UnknownHostException {
        coversService.AgencyCompanyadd(agencyCompany);
    }
    /**
     * @name  修改代理公司
     * @Author VULCAN
     * @Date 2020/2/1 11:50
     */
    @RequestMapping(value = "AgencyCompanyupdate",method = RequestMethod.POST)
    public void AgencyCompanyupdate(@RequestBody AgencyCompany agencyCompany) throws UnknownHostException {
        coversService.AgencyCompanyupdate(agencyCompany);
    }
    /**
     * @name  id查询
     * @Author VULCAN
     * @Date 2020/2/1 12:36
     */
    @RequestMapping(value = "AgencyCompanyFindId/{id}",method = RequestMethod.GET)
    public AgencyCompany AgencyCompanyFindId(@PathVariable("id") String id){
        return coversService.AgencyCompanyFindId(id);
    }
    /**
     * @name  批量删除
     * @Author VULCAN
     * @Date 2020/2/1 15:12
     */
    @RequestMapping(value = "agencyCompanybulkdel/{id}",method = RequestMethod.GET)
    public String agencyCompanybulkdel(@PathVariable String id) throws UnknownHostException {
        String[] ids = id.split(",");
        return coversService.agencyCompanybulkdel(ids);
    }

    /**
     * @name  套信息列表 分页 模糊
     * @Author VULCAN
     * @Date 2020/2/1 12:57
     */
    @RequestMapping(value = "findcoverlikename/{pageNum}/{pageSize}",method = RequestMethod.POST)
    public Result findcoverlikename(@RequestBody Cover covers, @PathVariable("pageNum") int pageNum , @PathVariable("pageSize") int pageSize){
        PageResult findallpage = coversService.findcoverlikename(covers,pageNum, pageSize);
        return new Result(true, StatusCode.OK,"查询成功",findallpage) ;
    }
    /**
     * @name  新增套信息
     * @Author VULCAN
     * @Date 2020/2/1 11:50
     */
    @RequestMapping(value = "coveradd",method = RequestMethod.POST)
    public void coveradd(@RequestBody Cover covers) throws UnknownHostException {
        coversService.coveradd(covers);
    }
    /**
     * @name  修改套信息
     * @Author VULCAN
     * @Date 2020/2/1 11:50
     */
    @RequestMapping(value = "coverupdate",method = RequestMethod.POST)
    public void coverupdate(@RequestBody Cover covers) throws UnknownHostException {
        coversService.coverupdate(covers);
    }
    /**
     * @name  id查询
     * @Author VULCAN
     * @Date 2020/2/1 12:36
     */
    @RequestMapping(value = "coverFindId/{id}",method = RequestMethod.GET)
    public Cover coverFindId(@PathVariable("id") String id){
        return coversService.coverFindId(id);
    }
    /**
     * @name  套信息批量删除
     * @Author VULCAN
     * @Date 2020/2/1 15:12
     */
    @RequestMapping(value = "coversbulkdel/{id}",method = RequestMethod.GET)
    public String coversbulkdel(@PathVariable String id) throws UnknownHostException {
        String[] ids = id.split(",");
        return coversService.coversbulkdel(ids);
    }
    /**
     * @name  套信息列表 分页 模糊
     * @Author VULCAN
     * @Date 2020/2/1 12:57
     */
    @RequestMapping(value = "findcoverVolikename/{pageNum}/{pageSize}",method = RequestMethod.POST)
    public Result findcoverVolikename(@RequestBody CoverVo CoverVo, @PathVariable("pageNum") int pageNum , @PathVariable("pageSize") int pageSize){
        PageResult findallpage = coversService.findcoverVolikename(CoverVo,pageNum, pageSize);
        return new Result(true, StatusCode.OK,"查询成功",findallpage) ;
    }
    /**
     * @name  id查询
     * @Author VULCAN
     * @Date 2020/2/1 12:38
     */
    @RequestMapping(value = "coverOrderFindId/{id}",method = RequestMethod.GET)
    public CoverOrder selectByPrimaryKey(@PathVariable("id") String id) {
        return coversService.selectByPrimaryKey(id);
    }
    /**
     * @name  新增套订单信息
     * @Author VULCAN
     * @Date 2020/2/1 11:50
     */
    @RequestMapping(value = "coverOrderadd",method = RequestMethod.POST)
    public void coverOrderadd(@RequestBody CoverOrder coverOrder) {
        coversService.coverOrderadd(coverOrder);
    }
    /**
     * @name  修改套订单信息
     * @Author VULCAN
     * @Date 2020/2/1 11:50
     */
    @RequestMapping(value = "coverOrderupdate",method = RequestMethod.POST)
    public void coverOrderupdate(@RequestBody CoverOrder coverOrder) {
        coversService.coverOrderupdate(coverOrder);
    }
    /**
     * @name  套信息批量审核
     * @Author VULCAN
     * @Date 2020/2/1 15:12
     */
    @RequestMapping(value = "coversbulkaudit/{id}",method = RequestMethod.GET)
    public String coversbulkaudit(@PathVariable String id) throws UnknownHostException {
        String[] ids = id.split(",");
        return coversService.coversbulkaudit(ids);
    }
    /**
     * @name  套信息审核列表 分页 模糊
     * @Author VULCAN
     * @Date 2020/2/1 12:57
     */
    @RequestMapping(value = "findcoverVoauditlikename/{pageNum}/{pageSize}",method = RequestMethod.POST)
    public Result findcoverVoauditlikename(@RequestBody CoverVo CoverVo, @PathVariable("pageNum") int pageNum , @PathVariable("pageSize") int pageSize){
        PageResult findallpage = coversService.findcoverVoauditlikename(CoverVo,pageNum, pageSize);
        return new Result(true, StatusCode.OK,"查询成功",findallpage) ;
    }
    /**
     * @name  套信息批量审核 通过
     * @Author VULCAN
     * @Date 2020/2/1 15:12
     */
    @RequestMapping(value = "coversbulkauditpass/{id}",method = RequestMethod.GET)
    public String coversbulkauditpass(@PathVariable String id) throws UnknownHostException {
        String[] ids = id.split(",");
        return coversService.coversbulkauditpass(ids);
    }
    /**
     * @name  套信息批量审核 驳回
     * @Author VULCAN
     * @Date 2020/2/1 15:12
     */
    @RequestMapping(value = "coversbulkauditturn/{id}",method = RequestMethod.GET)
    public String coversbulkauditturn(@PathVariable String id) throws UnknownHostException {
        String[] ids = id.split(",");
        return coversService.coversbulkauditturn(ids);
    }
    /**
     * @name  整合模糊  订单
     * @Author VULCAN
     * @Date 2020/2/1 12:38
     */
    @RequestMapping(value = "findcoverVoauditpasslikename/{pageNum}/{pageSize}",method = RequestMethod.POST)
    public Result findcoverVoauditpasslikename(@RequestBody CoverVo CoverVo, @PathVariable("pageNum") int pageNum , @PathVariable("pageSize") int pageSize){
        PageResult findallpage = coversService.findcoverVoauditpasslikename(CoverVo,pageNum, pageSize);
        return new Result(true, StatusCode.OK,"查询成功",findallpage) ;
    }
//    /**
//     * @name  查询订单
//     * @Author VULCAN
//     * @Date 2020/2/3 15:57
//     */
//    @RequestMapping(value = "findbyorder",method = RequestMethod.GET)
//    public List<Orders> findbyorder() {
//        return coversService.findbyorder();
//    }
//    /**
//     * @name  订购类型统计
//     * @Author VULCAN
//     * @Date 2020/2/3 19:27
//     */
//    @RequestMapping(value = "findbyordertype",method = RequestMethod.GET)
//    public List<Orders> findbyordertype() {
//        return coversService.findbyordertype();
//    }
//    /**
//     * @name  是否到货统计
//     * @Author VULCAN
//     * @Date 2020/2/3 19:27
//     */
//    @RequestMapping(value = "findbyorderarrival",method = RequestMethod.GET)
//    public List<Orders> findbyorderarrival() {
//        return coversService.findbyorderarrival();
//    }
    /**
     * @name  荐购学科统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectPuchasesubjectTj",method = RequestMethod.GET)
    public List<Purchase> selectPuchasesubjectTj() {
        return coversService.selectPuchasesubjectTj();
    }
    /**
     * @name  荐购国家统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectPuchasecountryTj",method = RequestMethod.GET)
    public List<Purchase> selectPuchasecountryTj() {
        return coversService.selectPuchasecountryTj();
    }
    /**
     * @name  荐购语种统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectPuchaselanguageTj",method = RequestMethod.GET)
    public List<Purchase> selectPuchaselanguageTj() {
        return coversService.selectPuchaselanguageTj();
    }
    /**
     * @name  荐购文献统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectPuchasetypeTj",method = RequestMethod.GET)
    public List<Purchase> selectPuchasetypeTj() {
        return coversService.selectPuchasetypeTj();
    }
    /**
     * @name  荐购币种统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectPuchasecurrencyTj",method = RequestMethod.GET)
    public List<Purchase> selectPuchasecurrencyTj() {
        return coversService.selectPuchasecurrencyTj();
    }
    /**
     * @name  荐购出版状态统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectPuchasepub_statusTj",method = RequestMethod.GET)
    public List<Purchase> selectPuchasepub_statusTj() {
        return coversService.selectPuchasepub_statusTj();
    }
    /**
     * @name  荐购载体统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectPuchasecarrierTj",method = RequestMethod.GET)
    public List<Purchase> selectPuchasecarrierTj() {
        return coversService.selectPuchasecarrierTj();
    }
    /**
     * @name  套信息列表
     * @Author VULCAN
     * @Date 2020/2/5 11:30
     */
    @RequestMapping(value = "CoverFindlist",method = RequestMethod.GET)
    public List<Cover> CoverFindlist() {
        return coversService.CoverFindlist();
    }
    /**
     * @name  套学科统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectcoversubjectTj",method = RequestMethod.GET)
    public List<Purchase> selectcoversubjectTj() {
        return coversService.selectcoversubjectTj();
    }
    /**
     * @name  套国家统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectcovercountryTj",method = RequestMethod.GET)
    public List<Purchase> selectcovercountryTj() {
        return coversService.selectcovercountryTj();
    }
    /**
     * @name  套语种统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectcoverlanguageTj",method = RequestMethod.GET)
    public List<Purchase> selectcoverlanguageTj() {
        return coversService.selectcoverlanguageTj();
    }
    /**
     * @name  套文献统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectcovertypeTj",method = RequestMethod.GET)
    public List<Purchase> selectcovertypeTj() {
        return coversService.selectcovertypeTj();
    }
    /**
     * @name  套载体统计
     * @Author VULCAN
     * @Date 2020/2/4 16:08
     */
    @RequestMapping(value = "selectcovercarrierTj",method = RequestMethod.GET)
    public List<Purchase> selectcovercarrierTj() {
        return coversService.selectcovercarrierTj();
    }
    /**
     * @name  id查询
     * @Author VULCAN
     * @Date 2020/2/7 14:30
     */
    @RequestMapping(value = "findcoverVofindById/{id}",method = RequestMethod.GET)
    public List<CoverVo> findcoverVofindById(@PathVariable("id") String id) {
        return coversService.findcoverVofindById(id);
    }
    /**
     * @name  查询套订单信息
     * @Author VULCAN
     * @Date 2020/2/7 15:51
     */
    @RequestMapping(value = "selectBycoverId/{coverId}",method = RequestMethod.GET)
    public List<CoverOrder> selectBycoverId(@PathVariable("coverId") String coverId) {
        return coversService.selectBycoverId(coverId);
    }
    /**
     * @name  查询套信息快照添加
     * @Author VULCAN
     * @Date 2020/2/8 10:01
     */
    @RequestMapping(value = "addCoverSnapshot",method = RequestMethod.POST)
    public void addCoverSnapshot(@RequestBody CoverSnapshot coverSnapshot) {
        coversService.addCoverSnapshot(coverSnapshot);
    }
    /**
     * @name  查询套信息快照
     * @Author VULCAN
     * @Date 2020/2/8 10:01
     */
    @RequestMapping(value = "selectByCoverSnapshot/{id}",method = RequestMethod.GET)
    public CoverSnapshot selectByCoverSnapshot(@PathVariable String id) {
        return coversService.selectByCoverSnapshot(id);
    }
    /**
     * @name  id查询套信息快照
     * @Author VULCAN
     * @Date 2020/2/9 17:32
     */
    @RequestMapping(value = "findcoversnapshotfindById/{id}",method = RequestMethod.GET)
    public CoverVo findcoversnapshotfindById(@PathVariable String id) {
        return coversService.findcoversnapshotfindById(id);
    }
    /**
     * @name  id查询套信息
     * @Author VULCAN
     * @Date 2020/2/9 17:32
     */
    @RequestMapping(value = "findcoverfindById/{id}",method = RequestMethod.GET)
    public CoverVo findcoverfindById(@PathVariable String id) {
        return coversService.findcoverfindById(id);
    }
}
